package com.kxj.xfyy;

import com.iflytek.cloud.ErrorCode;
import com.iflytek.cloud.SpeechSynthesizer;

import android.app.Service;
import android.content.Intent;
import android.os.IBinder;

public class SpeechSynthesisService extends Service {
	private SpeechSynthesizer speechSynthesizer;
	@Override
	public IBinder onBind(Intent intent) {
		return null;
	}
	@Override
	public int onStartCommand(Intent intent, int flags, int startId) {
		speechSynthesizer=TtsSpeechSynthesizer.getSpeechSynthesizer(this);
		TtsSpeechSynthesizer.setParameter();
		String textString=intent.getExtras().getString("UserText");
		if(TtsSpeechSynthesizer.initCode==ErrorCode.SUCCESS){
			speechSynthesizer.startSpeaking(textString, new TtsSynthesizerListener());
		}
		return START_STICKY;
	}
	@Override
	public void onDestroy() {
		super.onDestroy();
		
	}
}
